import Vue from 'vue'
import request from '@/utils/request'
import dayjs from 'dayjs'

Vue.prototype.$buryingPoint = function(url, value) {

  let item = localStorage.getItem('user_info')
  if (JSON.parse(item).name === '维护专用') {
    return
  }

  if(typeof value === 'object'){
    value = JSON.stringify(value)
  }

  const postData = {
    operateTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
    url,
    value
  }

  return request.post('records/addRecord', postData)
}
